package com.dnd.monitor;

import com.dnd.monitor.service.ExecuteService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.Scanner;
import java.util.concurrent.CompletableFuture;

/**
 * @author 安贺
 * @createTime 2022.08.11 13:03
 * 文书号筛查程序
 */
@SpringBootApplication
@Slf4j
public class DocNumDetectionApplication {

    private static ExecuteService executeService;

    @Autowired
    public DocNumDetectionApplication(ExecuteService executeService) {
        DocNumDetectionApplication.executeService = executeService;
    }


    public static void main(String[] args) {
        SpringApplication.run(DocNumDetectionApplication.class, args);
        System.out.println("双公示行政文书号筛查程序启动成功  O(∩_∩)O~......");
        System.out.println("请输入'start'开始执行:");
        Scanner scanner = new Scanner(System.in);
        if ("start".equals(scanner.next())) {
            System.out.println("两秒后开始执行....");
            CompletableFuture.runAsync(() -> {
                executeService.execute();
            });
        }

    }
}
